
struct SpriteLocation;

struct SpriteEntry
{
    inline UINT64 Hash64() const
    {
        return bmp.Hash64();
    }
    
    int index;
    bool transparent;
    RGBColor visualizationColor;
    Bitmap bmp;
    string name;
};

//
// Font sprites should always be the last thing added, which makes it much easier to cull font sprites when building feature vectors.
//

class SpriteCollection
{
public:
    inline const SpriteEntry& GetSprite(int spriteID) const
    {
        return *_spriteList[spriteID];
    }
    inline UINT NonFontSpriteCount() const
    {
        return _fontBase;
    }

    int AddSprite(const Bitmap &bmp, const string &name, bool forceAdd = false);
    void AddFontSprites();

    void DrawText(const string &message, const Vec2i &location, vector<SpriteLocation> &sprites, int spriteLayer) const;
    void DrawNumber(int number, int zeroPadding, const Vec2i &location, vector<SpriteLocation> &sprites, int spriteLayer) const;
    
    inline int FontBase() const {return _fontBase;}

private:
    Bitmap GetFontBitmap(char c) const;

    unordered_map<UINT64, const SpriteEntry*> _spriteMap;
    vector<const SpriteEntry*> _spriteList;
    
    //
    // _fontBase + 0 to _fontBase + 9 = '0' to '9'
    // _fontBase + 10 to _fontBase + 35 = 'A' to 'Z'
    //
    int _fontBase;

};
